import { Pipe, PipeTransform, LOCALE_ID, Injector } from '@angular/core';
import { DatePipe } from '@angular/common';

@Pipe({
	name: 'date',
})
export class MyDatePipe implements PipeTransform {
	defaultDate: DatePipe;
	constructor(private injector: Injector) {
		this.defaultDate = new DatePipe(injector.get(LOCALE_ID));
	}
	transform(value: any, format: string = 'yyyy/MM/dd HH:mm', timezone?: string, locale?: string) {
		return this.defaultDate.transform(value, format, timezone, locale);
	}
}
